﻿using Microsoft.Practices.Unity;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace NuGet.Testes
{
	[TestClass]
	public class UnitTests
	{
		[TestMethod]
		public void UsingTheNugets()
		{
			var container = new UnityContainer();
			var serviceLocator = new UnityCommonServiceManagerAdapter.UnityServiceLocator(container);
			var serviceConfigurator = new UnityCommonServiceManagerAdapter.Configuration.UnityServiceConfigurator(serviceLocator);

			serviceConfigurator.Configure<Foo>().InjectionProperties(f => f.Bar);

			var foo = serviceLocator.GetInstance<Foo>();

			Assert.IsNotNull(foo);
			Assert.IsNotNull(foo.Bar);
		}

		private class Foo
		{
			public Bar Bar { get; set; }
		}

		private class Bar { }
	}
}